/**
 * Copyright (c) 2011-2012 Nokia Corporation.
 */

#include <QtGui>
#include <QApplication>
#include <QDeclarativeView>
#include <QDeclarativeEngine>
#include "audioplugin.h"

// Lock orientation on Symbian
#ifdef Q_OS_SYMBIAN
#include <eikenv.h>
#include <eikappui.h>
#include <aknenv.h>
#include <aknappui.h>
#endif

using namespace GE;

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    AudioPlugin plugin;
    plugin.registerTypes("GEAudio");

    QDeclarativeView view;
    view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
    view.setSource(QUrl("qrc:/qml/AudioTest.qml"));
    QObject::connect(view.engine(), SIGNAL(quit()), &app, SLOT(quit()));

#ifdef Q_OS_SYMBIAN
    // Lock orientation
    CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi());
    TRAP_IGNORE(
        if (appUi)
            appUi->SetOrientationL(CAknAppUi::EAppUiOrientationPortrait);
    );
#endif

#if defined(Q_OS_SYMBIAN) || defined(MEEGO_EDITION_HARMATTAN) \
    || defined(Q_WS_SIMULATOR)
    view.setGeometry(QApplication::desktop()->screenGeometry());
    view.showFullScreen();
#else
    view.show();
#endif

    return app.exec();
}
